package com.jsyxdl.k3cloud.utils;

import com.hustcad.plm.pdm.form.model.vo.TyplmFormDataVO;
import com.hustcad.plm.pdm.form.service.TyFormDataExtService;
import com.hustcad.plm.pdm.partbom.dto.PartUsageLink;
import com.hustcad.plm.pdm.partbom.dto.QuerySubstituteLinkDTO;
import com.hustcad.plm.pdm.partbom.service.TyplmPartBomService;
import com.hustcad.plm.pdm.partbom.service.TyplmPartService;
import com.hustcad.plm.pdm.partbom.service.partalternate.TyplmPdmPartAlternateService;
import com.hustcad.plm.pdm.partbom.service.partalternate.TyplmPdmPartSubstituteService;
import com.hustcad.plm.pdm.partbom.vo.AlternateInfoVO;
import com.hustcad.plm.pdm.partbom.vo.PartDetailsVO;
import com.hustcad.plm.pdm.partbom.vo.PartSubstituteVO;

import javax.annotation.Resource;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.List;

public class PlmPartOptionUtils {
    @Resource
    public TyplmPartService typlmPartService;
    @Resource
    public TyplmPartBomService typlmPartBomService;
    @Resource
    public TyplmPdmPartAlternateService typlmPartAlternateService;
    @Resource
    public TyplmPdmPartSubstituteService typlmPartSubstituteService;
    @Resource
    public TyFormDataExtService tyFormDataExtService;


    //获取类型属性
    public PartDetailsVO getPartDetailsVO(BigInteger oid, String oType){
        PartDetailsVO partDetailsVO = this.typlmPartService.queryPartDetails(oid, oType);
        return partDetailsVO;
    }
    //获取BOM属性
    public PartUsageLink getPartUsageLink(BigInteger oid, String oType){
        PartUsageLink partUsageLink = this.typlmPartBomService.getPartUsageLinkInfo(oid, oType);
        return partUsageLink;
    }
    //获取全局替代件
    public List<AlternateInfoVO> getAlternateInfoVO(List<String> alternateForPartNumbers) throws ParseException {
        List<AlternateInfoVO> list = this.typlmPartAlternateService.batchQueryAlternates(alternateForPartNumbers);
        return list;
    }
    //获取局部替代件
    public List<PartSubstituteVO> getPartSubstituteVO(QuerySubstituteLinkDTO querySubstituteLinkDTO){
        List<PartSubstituteVO> list=this.typlmPartSubstituteService.queryPartSubstituteLink(querySubstituteLinkDTO);
        return list;
    }
    //获取表单属性
    public TyplmFormDataVO getTyplmFormDataVO(BigInteger oid){
        TyplmFormDataVO formDataVO = this.tyFormDataExtService.getFormDataDetail(oid);

        return formDataVO;
    }
}
